﻿<%@ Page Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" CodeFile="post.aspx.cs" Inherits="Admin_post" Title="Posts Management" %>
<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="RadDatePicker" ResourceUICultures="RadDatePicker" />
        </Scripts>
    </asp:ScriptManager>
    <center>            
        <asp:Button ID="cmdChooseCom" runat="server"  
            Text="Choose Competition" Height="30px" onclick="cmdChooseCom_Click" />
        &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Label ID="lblTitleCom" runat="server" Font-Bold="true"></asp:Label>
        <asp:TextBox ID="txtIdCom" runat="server" Visible="False" Width="50px"></asp:TextBox>
        </center>
        
     <asp:Panel ID="PanelResult" CssClass="panel" runat="server">
        <fieldset style=" border:solid 1px black; ">
        <legend style=" font-weight:bold;color:black; font-size:14px;">Result</legend>
        <div class="row">
            <div class="left" style="text-align:center">1st Post:</div>
            <div class="right" style="width:850px;" >Title:&nbsp;
                <asp:TextBox ID="txt1stTitle" runat="server" width="350px" Enabled = "false"></asp:TextBox>
                &nbsp;Author:&nbsp;
                <asp:TextBox ID="txt1stName" runat="server" width="250px" Enabled = "false"></asp:TextBox>
                &nbsp;&nbsp;<asp:TextBox ID="txt1stId" runat="server" Visible="False" 
                    Width="50px"></asp:TextBox>
                    <asp:Label ID="lbl1stError" runat="server" ForeColor="Red" Text="Not null" 
                    Visible="False"></asp:Label>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left" style="text-align:center">2nd Post:</div>
            <div class="right" style="width:850px;">Title:&nbsp;
                <asp:TextBox ID="txt2ndTitle" runat="server" width="350px" Enabled = "false"></asp:TextBox>
                &nbsp;Author:&nbsp;
                <asp:TextBox ID="txt2ndName" runat="server" width="250px" Enabled = "false"></asp:TextBox>
                &nbsp;&nbsp;<asp:TextBox ID="txt2ndId" runat="server" Visible="False" 
                    Width="50px"></asp:TextBox>
                    <asp:Label ID="lbl2ndError" runat="server" ForeColor="Red" Text="Not null" 
                    Visible="False"></asp:Label>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left" style="text-align:center">3rd Post:</div>
            <div class="right" style="width:850px;">Title:&nbsp;
                <asp:TextBox ID="txt3rdTitle" runat="server" width="350px" Enabled = "false"></asp:TextBox>
                &nbsp;Author:&nbsp;
                <asp:TextBox ID="txt3rdName" runat="server" width="250px" Enabled = "false"></asp:TextBox>
                &nbsp;&nbsp;<asp:TextBox ID="txt3rdId" runat="server" Visible="False" 
                    Width="50px"></asp:TextBox>
                    <asp:Label ID="lbl3rdError" runat="server" ForeColor="Red" Text="Not null" 
                    Visible="False"></asp:Label>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left"></div>
            <div class="right" style="width:830px; margin:10px;">
                <asp:Button ID="cmdUpdateResult" runat="server" Text="Update Result" 
                    onclick="cmdUpdateResult_Click"/>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="cmdClear" runat="server" Text="Clear" onclick="cmdClear_Click"/>
                &nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
        <div class="clear"></div>
        </fieldset>
    </asp:Panel>
    
    <asp:Panel ID="Panel1" CssClass="panel" runat="server">
        <div class="row">
            <div class="left">ID:</div>
            <div class="right"><asp:TextBox ID="txtId" runat="server" Width="50px" 
                    Enabled="False" ></asp:TextBox></div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Title:</div>
            <div class="right"><asp:TextBox ID="txtTitle" runat="server" Width="350px" 
                    Enabled="False"></asp:TextBox>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Description:</div>
            <div class="right"><asp:TextBox ID="txtDes" runat="server" Width="350px" 
                    Height="80px" TextMode="MultiLine"></asp:TextBox>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Content:</div>
            <div class="right"><CKEditor:CKEditorControl ID="CKEditor1" runat="server" 
                    Width="770px"></CKEditor:CKEditorControl>
                    </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Status:</div>
            <div class="right">
                <asp:RadioButtonList ID="RadioButtonList1" runat="server" 
                    RepeatDirection="Horizontal">
                
                    <asp:ListItem Value="True">Active</asp:ListItem>
                    <asp:ListItem Value="False">Inactive</asp:ListItem>
                
                </asp:RadioButtonList>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Start Date:</div>
            <div class="right">
            <telerik:RadDatePicker ID="RadDatePicker1" runat="server" DateInput-DateFormat="dd/MM/yyyy">
            </telerik:RadDatePicker>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">End Date:</div>
            <div class="right">
            <telerik:RadDatePicker ID="RadDatePicker2" runat="server" DateInput-DateFormat="dd/MM/yyyy">
            </telerik:RadDatePicker>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left"></div>
            <div class="right" style="margin:10px 0px">
                <asp:Button ID="cmdChoose" runat="server" Text="Choose this Competition" 
                    onclick="cmdChoose_Click" Height="30px" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="cmdHide" runat="server" Text="Hide" onclick="cmdHide_Click" 
                    Height="30px" />
                &nbsp;&nbsp;&nbsp;&nbsp;
            </div>
        </div>
        <div class="clear"></div>
    </asp:Panel>
    <asp:Panel ID="Panel2" runat="server">
    
    <div style="text-align:center;margin:10px;font-weight:bold;font-size:18px;">
        <asp:Label ID="lblInfo" runat="server" Text="Please choose competition first"></asp:Label>
    </div> 
        <asp:GridView ID="GridView1" runat="server" BackColor="White" 
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="6" 
            ForeColor="Black" GridLines="Horizontal" AllowPaging="True" 
            AutoGenerateColumns="False" Width="990px" DataKeyNames="id" onrowediting="GridView1_RowEditing" 
            onpageindexchanging="GridView1_PageIndexChanging">
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <Columns>
                <asp:BoundField DataField="id" HeaderText="ID" />
                <asp:BoundField DataField="title" HeaderText="Title" />
                <asp:BoundField DataField="status" HeaderText="Status" />
                <asp:BoundField DataField="sdate" HeaderText="Start Date" />
                <asp:BoundField DataField="eDate" HeaderText="End Date" />
                <asp:BoundField DataField="result" HeaderText="Has Result" />
                <asp:CommandField EditImageUrl="~/images/Admin/information.png" HeaderText="View" 
                    ShowEditButton="True" ButtonType="Image" >
                    <ItemStyle Font-Underline="True" HorizontalAlign="Center" Width="40px" />
                </asp:CommandField>
            </Columns>
            <PagerStyle BackColor="#99CCFF" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        </asp:GridView>

     </asp:Panel>
     
     <asp:Panel ID="Panel3" CssClass="panel" runat="server">
        <div class="row">
            <div class="left">ID:</div>
            <div class="right"><asp:TextBox ID="txtPostId" runat="server" Width="50px" 
                    Enabled="False" ></asp:TextBox></div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Author:</div>
            <div class="right"><asp:TextBox ID="txtPostAuthor" runat="server" Width="350px" 
                    Enabled="False"></asp:TextBox>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Title:</div>
            <div class="right"><asp:TextBox ID="txtPostTitle" runat="server" Width="350px" 
                    Enabled="False"></asp:TextBox>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Content:</div>
            <div class="right">
                <CKEditor:CKEditorControl ID="CKEditor2" runat="server" 
                    Width="770px" Enabled="False"></CKEditor:CKEditorControl>
                    </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left">Received date:</div>
            <div class="right">
            <telerik:RadDatePicker ID="RadDatePicker3" runat="server" DateInput-DateFormat="dd/MM/yyyy">
            </telerik:RadDatePicker>
            </div>
        </div>
        <div class="clear"></div>
        <div class="row">
            <div class="left"></div>
            <div class="right">
                <asp:Button ID="cmdSet1st" runat="server" Text="Set 1st Post" 
                    onclick="cmdSet1st_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="cmdSet2nd" runat="server" Text="Set 2nd Post" 
                    onclick="cmdSet2nd_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="cmdSet3rd" runat="server" Text="Set 3rd Post" 
                    onclick="cmdSet3rd_Click" />
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Button ID="cmdHidePost" runat="server" Text="Hide" 
                    onclick="cmdHidePost_Click" />   
            </div>
        </div>
        <div class="clear"></div>
    </asp:Panel>
    <asp:Panel ID="Panel4" runat="server">
        <asp:GridView ID="GridView2" runat="server" BackColor="White" 
            BorderColor="#CCCCCC" BorderStyle="None" BorderWidth="1px" CellPadding="6" 
            ForeColor="Black" GridLines="Horizontal" AllowPaging="True" 
            AutoGenerateColumns="False" Width="990px" DataKeyNames="id" 
            onrowdeleting="GridView2_RowDeleting" onrowediting="GridView2_RowEditing" 
            onpageindexchanging="GridView2_PageIndexChanging">
            <FooterStyle BackColor="#CCCC99" ForeColor="Black" />
            <Columns>
                <asp:BoundField DataField="id" HeaderText="ID" />
                <asp:BoundField DataField="fullName" HeaderText="Author" />
                <asp:BoundField DataField="title" HeaderText="Title" />
                <asp:BoundField DataField="date" HeaderText="Received Date" />
                <asp:BoundField DataField="rank" HeaderText="Rank" />
                <asp:CommandField EditImageUrl="~/images/Admin/information.png" HeaderText="View" 
                    ShowEditButton="True" ButtonType="Image" >
                    <ItemStyle Font-Underline="True" HorizontalAlign="Center" Width="40px" />
                </asp:CommandField>
                <asp:TemplateField HeaderText="Delete">
                    <ItemTemplate>
                        <asp:Button ID="deleteButton" runat="server" CommandName="Delete" style="width:16px;height:16px;background:url(../images/Admin/cross.png);border:none;cursor:pointer;" OnClientClick="return confirm('Are you sure?');" />
                    </ItemTemplate>
                    <ItemStyle HorizontalAlign="Center" Width="40px" />
                </asp:TemplateField>
            </Columns>
            <PagerStyle BackColor="#99CCFF" ForeColor="Black" HorizontalAlign="Right" />
            <SelectedRowStyle BackColor="#CC3333" Font-Bold="True" ForeColor="White" />
            <HeaderStyle BackColor="#333333" Font-Bold="True" ForeColor="White" />
        </asp:GridView>

     </asp:Panel>
</asp:Content>

